Skip to content

Add federated authorization tutorial - #576

Open
sohanmaheshwar wants to merge 2 commits into
mainfrom
federated-authorization-tutorial
Open

Add federated authorization tutorial#576
sohanmaheshwar wants to merge 2 commits into
mainfrom
federated-authorization-tutorial

Conversation

@sohanmaheshwar

Copy link
Copy Markdown
Contributor

What

Adds a new tutorial: Federate Authorization Across Multiple Identity Providers (spicedb/tutorials/federated-authorization).

It walks through using SpiceDB to centralize permissions when users authenticate through different identity providers (Keycloak OIDC + GitHub OAuth): each external account (keycloak_account, github_account) binds to a canonical internal user, and documents reference only that user — so the authorization model is unaffected by which IdP a user came from.

Contents

  • Schema for the *_account → bound_to → user binding pattern
  • The per-login identity-resolution step, with zed and Python examples for grant / check / share / lookup
  • A note on consistency (ZedToken / at_least_as_fresh)
  • Architecture diagram (FIG 01)
  • Links to the runnable demo at authzed/examples/federated-authorization

Added to the Tutorials nav via app/spicedb/tutorials/_meta.ts.

Note

The link to authzed/examples/federated-authorization resolves once authzed/examples#48 merges.

Adds a tutorial showing how to federate authorization across multiple identity providers (Keycloak OIDC + GitHub OAuth) by binding each external account to a canonical internal SpiceDB user. Includes the architecture diagram and links to the runnable demo in authzed/examples.

Signed-off-by: Sohan Maheshwar <1119120+sohanmaheshwar@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Preview deployment status for this pull request.

Name Status Preview Updated (UTC)
docs 🟢 Ready Visit Preview Jul 29, 2026 01:06pm

@tstirrat15 tstirrat15 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

Comment thread app/spicedb/tutorials/federated-authorization/page.mdx Outdated
Comment on lines +171 to +173
The check names a `user`, not a Keycloak or GitHub account.
Authentication is upstream; this is downstream.
They meet at the `user` id and nowhere else.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the level of detail you want to get to, but this requires the authentication layer to have the mapping as well, because otherwise the calling application doesn't have this association. At $PREVIOUS_JOB we had a set of bindings between Auth0 and our application server that then attached this internal user ID as a custom claim on the JWT. Otherwise you do want to check using the identity provided by the IDP, and ideally you note the IDP ID associated with the user somewhere in your application for administration purposes.

</Tabs>

That returns everything reachable through any path (owned, editor, or viewer) without those rules living in your app.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General note: I think it's worth calling out the work required to associate users from different identity providers - otherwise the internal user ID is just a layer of indirection.

Addresses review feedback: avoid two sequential callouts by nesting each warning under the list item it pertains to.

Signed-off-by: Sohan Maheshwar <1119120+sohanmaheshwar@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants